import request from '@/utils/request'



export default{


  equipment(dataForm) {

    return request({
      //@设备型号与设备名感觉是一样的哇 不需要再加一个了
      url: `/equipment`,
      method: 'post',
      data:{
        createPin:dataForm.createPin,
        //createTime:dataForm.createTime,
        electrodeCoordinateDistribution:dataForm.electrodeCoordinateDistribution,
        electrocardioElectrode:dataForm.electrocardioElectrode,
        electrodeMaterial:dataForm.electrodeMaterial,
        equipmentName:dataForm.equipmentType,
        equipmentType:dataForm.equipmentType,
        eyeElectrodes:dataForm.eyeElectrodes,
        id:1,
        leadNumber:dataForm.leadNumber,
        sitePkId:dataForm.sitePkId,
        siteName:dataForm.siteName,
        description:dataForm.description

        //@这里有个问题啊 id不是后端自己添加的吗 应该不用前端来进行添加的吧(这个其实无所谓的 都是这样直接加入进去的)
      }
    })
  },
  equipmentSearch(sitePkId,pageIndex,pageSize)
  {
    return request({
      url: `/equipment/search`,
      method: 'post',
      data:{
        sitePkId:sitePkId,
        pageNum:pageIndex,
        pageSize:pageSize
      }
    })


  },

  getEquipmentByUser(userName,pageSize,pageNum)
  {
    return request({
      url: `/equipment/getEquipmentByUser?userName=${userName}&pageNum=${pageNum}&pageSize=${pageSize}`,
      method: 'get',
    })

  },

  deleteEquipment(id)
  {
    return request({
      url: `/equipment/delete/${id}`,
      method: 'POST',
    })
  },

  getById(id) {
    return request({
      url: `/equipment/${id}`,
      method: 'GET',
    })
  },

  updateEquipment(dataForm)
  {
    return request({
      //@设备型号与设备名感觉是一样的哇 不需要再加一个了
      url: `/equipment`,
      method: 'put',
      params:{
        createPin:dataForm.createPin,
        //createTime:dataForm.createTime,
        electrodeCoordinateDistribution:dataForm.electrodeCoordinateDistribution,
        electrocardioElectrode:dataForm.electrocardioElectrode,
        electrodeMaterial:dataForm.electrodeMaterial,
        equipmentName:dataForm.equipmentType,
        equipmentType:dataForm.equipmentType,
        eyeElectrodes:dataForm.eyeElectrodes,
        id:dataForm.id,
        leadNumber:dataForm.leadNumber,
        sitePkId:dataForm.sitePkId,
        siteName:dataForm.siteName,
        description:dataForm.description


      }
    })

  }
}
